package com.itkim.work.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.itkim.work.domain.YzFile;
import com.itkim.work.domain.YzWorkRes;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.itkim.work.mapper.YzWorkMapper;
import com.itkim.work.domain.YzWork;
import com.itkim.work.service.IYzWorkService;
import com.ruoyi.common.core.text.Convert;

/**
 * 作品管理Service业务层处理
 * 
 * @author itkim
 * @date 2024-06-06
 */
@Service
public class YzWorkServiceImpl implements IYzWorkService 
{
    @Autowired
    private YzWorkMapper yzWorkMapper;

    /**
     * 查询作品管理
     * 
     * @param workId 作品管理主键
     * @return 作品管理
     */
    @Override
    public YzWorkRes selectYzWorkResByWorkId(Long workId)
    {
        return yzWorkMapper.selectYzWorkResByWorkId(workId);
    }

    /**
     * 查询作品管理列表
     * 
     * @param yzWorkRes 作品管理
     * @return 作品管理
     */
    @Override
    public List<YzWorkRes> selectYzWorkList(YzWorkRes yzWorkRes)
    {
        return yzWorkMapper.selectYzWorkList(yzWorkRes);
    }

    @Override
    public Map<String,Object> look(YzWorkRes yzWorkRes) {
        Map<String,Object> list = new HashMap<>();
        YzWorkRes workRes = yzWorkMapper.selectYzWorkResByWorkId(yzWorkRes.getWorkId());
        list.put("workInfo",workRes);

        List<YzFile> yzFile = yzWorkMapper.selectYzFileByWorkId(yzWorkRes.getWorkId());
        list.put("fileInfo",yzFile);

        yzWorkMapper.updateVisitNumber(yzWorkRes.getWorkId());
        return list;
    }
}